<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="format-detection" content="telephone=yes"/>
  <title></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['PLUGIN_CSS']}shopplan/static/css/reset.css">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['PLUGIN_CSS']}shopplan/static/css/swiper.min.css">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['PLUGIN_CSS']}shopplan/static/css/style.css?v=1126">
  <script src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/js/screen.js"></script>
  <script src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/js/jquery.js"></script>
  <script type="text/javascript">
  	
  	//选择店铺
  	function selectshop(shopid){
  	  var birthday = $("#birthday").val();
      if (birthday == undefined) {
        birthday = '{$birthday}';
      }
      var isReplace = false;
  	  if(shopid == 0 && '{$defaultShopId}' > 0){
          shopid = '{$defaultShopId}';
          isReplace = true;
      }
  	  var postUrl='/{php echo createMobileUrl("wx",array("planedid"=>$planedid,"themeid"=>$themeid,"from"=>"mobile","r"=>"shopplan.getcalendar"));}';
  	  {if $date}
  	    postUrl = '/{php echo createMobileUrl("wx",array("planedid"=>$planedid,"themeid"=>$themeid,"date"=>$date,"from"=>"mobile","r"=>"shopplan.getweeknav"));}';
  	  {/if}
  	  postUrl+='&birthday='+birthday;
  	  postUrl+='&shopid='+shopid;
        if(isReplace){
            window.location.replace(postUrl);//替换当前页
        }else{
            window.location.href = postUrl;//跳转页面
        }
  	}
  	if('{$shoplength}' == 1 && '{$agelimit}' == 0){
  	  selectshop(0);
  	}else if('{$shoplength}' == 1 && '{$agelimit}' == 1 && '{$birthday}'){
  	  selectshop(0);
  	}
  </script>
  <script src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/js/swiper.min.js"></script>
  <script src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/js/LiftEffect.js"></script>
  <!-- 以下：时间弹窗样式等 -->
		<link  rel="stylesheet" href="{$_G['URL']['PLUGIN_CSS']}shopplan/static/css/index.css"/>
		<!-- 引入 Vue 和 Vant 的 JS 文件 -->
		<script src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/js/vue@next.js"></script>
		<script src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/js/vant.min.js"></script>
<style>
.van-popup{
  width: 6.56rem;
  height: 7.04rem;
  border-radius: 0.14rem;
  background: #FFFFFF;
}
.van-picker__toolbar{
	display: none;
}
.van-popup h5{
	
	  font-size: 0.36rem;
	  color: #333333;
	  margin-top: 0.36rem;
	  text-align: center;
}
.van-popup p{
  color: #666666;
  text-align: center;
  margin-top: 0.12rem ;
}
.van-picker__columns{
	
	background: #f6f6f6;
  margin: 0.36rem auto;
  border: 0.01rem solid #f2f2f2;
  
    width: 5.30rem;
    height: 2.62rem;
}
.van-picker-column__item{
}
.van-picker-column__item--selected{
	color: #8926a5;
	background: #ffffff;
}

.btn_wrap{
  border: 0.01rem solid #f1f1f1;
  width: 5.28rem;
  margin: 0 auto;
  height: 0.68rem;
  border-radius: 0.34rem;
  display: flex;
  justify-content: space-around;
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
}
.btn_wrap .button{
  appearance: none;
  -ms-progress-appearance: none;
  background: none;
  font-size: 0.24rem; 
  height: 0.68rem;
  line-height: 0.68rem;
  padding-top: 0;
  padding-bottom: 0;
  color: #666666;
  font-weight: bold;
}
.headSearch{
    margin-top: 0px;
}
</style>
  <!-- 以上：时间弹窗样式等 -->
 </head>

 <body>
 {if $agelimit > 0}
  <div class="topBox">
    <div class="choseDate">
      <p>宝贝生日</p>
      <input id="birthday" type="date" name="birthday" value="{$birthday}">
    </div>
  </div>
 {/if}
 	<div class="headSearch">
  	<div class="seBox">
      	<button type="submit"></button>
          <input type="text" placeholder="搜索门店" id="input" value="{if $search_data}{$search_data}{/if}">
      </div>
  </div>
  <div class="adreessCont">
  	<div class="contTitle">可预约门店</div>
    <ul>
    {loop $shopconfig $index $item}
    	<li>
        <a href="javascript:" onclick="selectshop({$item['shopid']})"  class="marketBtn">
      	<div class="adressLeft">
        	<div class="adTit">
          	<h2 style="color: black;">{$item['name']}</h2>
              <h3 style="display: none;">可预约门店</h3>
          </div>
          <p>{$item['address']}<br>电话：{$item['phone']}</p>
          <div class="addTag" style="display: none;">
          	<span class="tagStyle1"></span>
              <span class="tagStyle2" >点击选择店铺可约</span>
          </div>
        </div>
        </a>
        <div class="adControl">
        	<a href="tel:{$item['phone']}" class="telBtn"><img src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/images/dianhua.png"></a>
            <a href="javascript:" onclick="selectshop({$item['shopid']})"  class="marketBtn"><img src="{$_G['URL']['PLUGIN_CSS']}shopplan/static/images/mendian.png"></a>
        </div>
      </li>
    {/loop}
    </ul>
  </div>


<!-- 以下：宝贝生日弹窗 -->
<div id="pop_papp">
	<van-popup v-model:show="show">
	<h5>选择宝贝生日</h5>
	<p>{{chooseDate.getFullYear()+"年"+(chooseDate.getMonth()+1)+"月"+chooseDate.getDate()+"日"}}</p>
	 <div class="btn_wrap">
		 <a href="javascript:" onclick="selected()" class="button">确定</a>
	 </div>
		<van-datetime-picker v-model="chooseDate"	type="date" title="选择年月日" :min-date="minDate" :max-date="maxDate" 
    	 confirm-button-text="" @change="change" item-height="0.6rem" visible-item-count="5"/>
	 </van-popup>
</div>
</body>
<script type="text/javascript">
  $("#pop_papp").hide();
  var chooseDate;
  const { createApp } = Vue;
  const app = {
    data() {
      return {
  		show:true,
  	  minDate: new Date(1949, 9, 1),
  	  maxDate: new Date(),
  	  chooseDate:new Date(2020, 0, 1),
      }
    },
    methods:{
  	  change(){
  		  chooseDate=this.chooseDate
  	  }
    }
  }
  createApp(app).use(vant).use(vant.Popup).use(vant.DatetimePicker).mount('#pop_papp');



  function openPicker(){
            //调用此方法可弹出日期选择框
  	$("#pop_papp").show();
  }

  function selected(){
            //选择弹窗宝贝生日后的事件
    $("#pop_papp").hide();
    if (chooseDate == undefined) {
      var chooseDate = new Date(2020, 0, 1);
    }

    var month = chooseDate.getMonth()+1;
    if (month < 10) {
      month = '0'+month;
    }
    var day = chooseDate.getDate();
    if (day < 10) {
      day = '0'+day;
    }
    
    var birthday = chooseDate.getFullYear()+"-"+month+"-"+day;
    var postUrl = '/{php echo createMobileUrl("wx",array("planedid"=>$planedid,"themeid"=>$themeid,"date"=>$date,"from"=>"mobile","r"=>"shopplan.getshops"));}';
        postUrl+='&birthday='+birthday;
        
    // window.location.href = postUrl;
  }
  //店铺搜索
  $('#input').bind('input propertychange', function() {
      var birthday = $("#birthday").val();
      var search_data = $(this).val();
      var postUrl = '/{php echo createMobileUrl("wx",array("planedid"=>$planedid,"themeid"=>$themeid,"date"=>$date,"from"=>"mobile","r"=>"shopplan.getshops"));}';
      postUrl+='&search_data='+search_data;
      postUrl+='&birthday='+birthday;
      window.location.href = postUrl;
   });

  {if !$birthday && $agelimit == 1}
    openPicker();//调用此方法可弹出日期选择框
  {/if}
</script>
 {include file='base/addlog'}
</html>
